package com.model;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;

@Entity
public class WxUserGroup {
	
	private Integer id;
	private String name; //组名
	private Integer diynum;//
	private Integer connectnum;//接收请求次数
	private boolean iscopyright;
	private Integer activitynum;//能创建活动次数
	private Float price;//会员价格
	private String statistic_user;
	private Integer create_card_num;//能开卡数
	private boolean status;//这个组的状态
	private Set<WxUser> wxusers = new HashSet<WxUser>();
	
	private Set<WxFunctions> wxfuns = new HashSet<WxFunctions>();
	
	@ManyToMany(mappedBy="userGroups")
	@JoinTable(name="wxgroup_funs",
		joinColumns={@JoinColumn(name="wxUserGroup_id")},
		inverseJoinColumns={@JoinColumn(name="wxFuns_id")}
	)
	public Set<WxFunctions> getWxfuns() {
		return wxfuns;
	}
	public void setWxfuns(Set<WxFunctions> wxfuns) {
		this.wxfuns = wxfuns;
	}
	@OneToMany(cascade={CascadeType.REMOVE},fetch=FetchType.EAGER,mappedBy="wxgroup")
	public Set<WxUser> getWxusers() {
		return wxusers;
	}
	public void setWxusers(Set<WxUser> wxusers) {
		this.wxusers = wxusers;
	}
	
	@Id
	@GeneratedValue
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public Integer getDiynum() {
		return diynum;
	}
	public void setDiynum(Integer diynum) {
		this.diynum = diynum;
	}
	public Integer getConnectnum() {
		return connectnum;
	}
	public void setConnectnum(Integer connectnum) {
		this.connectnum = connectnum;
	}
	public boolean isIscopyright() {
		return iscopyright;
	}
	public void setIscopyright(boolean iscopyright) {
		this.iscopyright = iscopyright;
	}
	public Integer getActivitynum() {
		return activitynum;
	}
	public void setActivitynum(Integer activitynum) {
		this.activitynum = activitynum;
	}
	public Float getPrice() {
		return price;
	}
	public void setPrice(Float price) {
		this.price = price;
	}
	public String getStatistic_user() {
		return statistic_user;
	}
	public void setStatistic_user(String statistic_user) {
		this.statistic_user = statistic_user;
	}
	public Integer getCreate_card_num() {
		return create_card_num;
	}
	public void setCreate_card_num(Integer create_card_num) {
		this.create_card_num = create_card_num;
	}
	public boolean isStatus() {
		return status;
	}
	public void setStatus(boolean status) {
		this.status = status;
	}
}
